package com.teradata.dashboard.ui.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.teradata.dashboard.R;



public class ResignActivity extends Activity implements OnClickListener  {
    @Override  
    public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        //this.requestWindowFeature(Window.FEATURE_NO_TITLE);  
        setContentView(R.layout.resign);  
        Button btn_sure = (Button) findViewById(R.id.btn_sure);
        
        //final LinearLayout errorLinear = (LinearLayout) findViewById(R.id.text_error);
        //final TextView show = (TextView) findViewById(R.id.text);
        //final TextView show = new TextView(this);
        //errorLinear.addView(show);
        /*show.setLayoutParams(new ViewGroup.LayoutParams(
        		ViewGroup.LayoutParams.WRAP_CONTENT,
        		ViewGroup.LayoutParams.WRAP_CONTENT));*/
        
        btn_sure.setOnClickListener(new OnClickListener(){
        	public void onClick(View v)
        	{
        		//show.setText("");
        		EditText userName = (EditText) findViewById(R.id.et_account);
                
                
                if(!userName.getText().toString().equals(""))
                {
                	//调用service层函数，向后台发送创建用户请求。
                	
                	Intent intent = new Intent(ResignActivity.this, LoginActivity.class);
                	startActivity(intent);
                }
                else{
                	//show.setText("账号或密码有误");
                	AlertDialog.Builder builder = new Builder(ResignActivity.this);
                	builder.setMessage("请输入用户名");
                	builder.setPositiveButton("是", null);
                	builder.show();
                }
        	}
        });
        
        
    }

	@Override
	public void onClick(View arg0) {
		// TODO 自动生成的方法存根
		
	}  

}
